package com.tanhua.sso.controller;

import com.tanhua.sso.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 更新用户的基本信息
     *
     * @param param
     * @return
     */
    @PostMapping("/loginReginfo")
    public Object loginRegInfo(@RequestBody Map<String, String> param, @RequestHeader("Authorization") String token) {
        return this.userInfoService.loginRegInfo(param, token);
    }

    /**
     * 更新用户的头像
     *
     * @param multipartFile
     * @return
     */
    @PostMapping("/loginReginfo/head")
    public Object loginRegInfoLogo(@RequestParam("headPhoto") MultipartFile multipartFile, @RequestHeader("Authorization") String token) {
        return this.userInfoService.loginRegInfoLogo(multipartFile, token);
    }

}
